{% load static %}
<!doctype html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <title>登录</title>
    <!-- Bootstrap 5 CDN -->
    <link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/css/site.css" rel="stylesheet">
    <style>
        body {
            background: 
                radial-gradient(900px 440px at -10% -10%, rgba(79,70,229,0.12), transparent 60%),
                radial-gradient(840px 420px at 110% -10%, rgba(16,185,129,0.12), transparent 60%),
                #f7f8fb;
            min-height: 100vh;
            display: flex;
            align-items: center;
            padding: 20px 0;
        }
        .login-container {
            max-width: 450px;
            margin: auto;
        }
        .logo-img {
            text-align: center;
            margin-bottom: 20px;
        }
        .logo-img img {
            width: 80px;
            height: 80px;
            object-fit: cover;
        }
        .card {
            border-radius: 14px;
            border: 1px solid rgba(17, 24, 39, .06);
            box-shadow: 0 10px 24px rgba(0, 0, 0, .06);
            transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
        }
        .card:hover {
            transform: translateY(-2px); 
            box-shadow: 0 16px 36px rgba(0,0,0,.10); 
            border-color: rgba(17,24,39,.10); 
        }
        .card-header {
            background: linear-gradient(135deg, #4f46e5, #7c3aed);
            color: white;
            border-radius: 14px 14px 0 0 !important;
            text-align: center;
            padding: 20px;
        }
        .form-control {
            border: 1px solid rgba(17, 24, 39, .12);
            border-radius: 10px;
            padding: 10px 12px;
            background: #fff;
            outline: none;
            transition: box-shadow .15s ease, border-color .15s ease;
        }
        .form-control:focus {
            border-color: #4f46e5;
            box-shadow: 0 0 0 4px rgba(79, 70, 229, .2);
        }
        .btn-primary {
            background: #4f46e5;
            border-color: #4f46e5;
            border-radius: 10px;
            font-weight: 600;
            transition: transform .08s ease, box-shadow .2s ease, filter .2s ease;
            padding: 10px;
        }
        .btn-primary:hover {
            background: #4338ca;
            border-color: #4338ca;
            box-shadow: 0 8px 18px rgba(79,70,229,.25);
        }
        .btn-primary:active { 
            transform: translateY(1px) scale(0.99); 
            filter: brightness(.98); 
        }
        .btn-outline-primary {
            border-color: #4f46e5;
            color: #4f46e5;
        }
        .btn-outline-primary:hover {
            background: #4f46e5;
            box-shadow: 0 8px 18px rgba(79,70,229,.25);
        }
        .alert {
            border-radius: 10px;
        }
    </style>
</head>
<body>
    <div class="container login-container">
        <div class="logo-img">
            <svg xmlns="http://www.w3.org/2000/svg" width="80" height="80" fill="currentColor" class="bi bi-people-fill" viewBox="0 0 16 16">
                <path d="M7 14s-1 0-1-1 1-4 5-4 5 3 5 4-1 1-1 1H7zm4-6a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"/>
                <path fill-rule="evenodd" d="M5.216 14A2.238 2.238 0 0 1 5 13c0-1.355.68-2.75 1.936-3.72A6.325 6.325 0 0 0 5 9c-4 0-5 3-5 4s1 1 1 1h4.216z"/>
                <path d="M4.5 8a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5z"/>
            </svg>
        </div>
        
        <div class="card shadow">
            <div class="card-header">
                <h3 class="mb-0">大学生论坛系统</h3>
                <p class="mb-0 mt-1">用户登录</p>
            </div>
            <div class="card-body p-4">
                <form action="" method="post">
                    {% csrf_token %}

                    <div class="mb-3">
                        <label class="form-label">{{ form.username.label }}</label>
                        {{ form.username }}
                        {% if form.username.errors %}
                        {% for error in form.username.errors %}
                            <div class="alert alert-danger mt-2" role="alert">
                            {{ error }}
                            </div>
                        {% endfor %}
                        {% endif %}
                    </div>
                    <div class="mb-3">
                        <label class="form-label">{{ form.password.label }}</label>
                        {{ form.password }}
                        {% if form.password.errors %}
                        {% for error in form.password.errors %}
                            <div class="alert alert-danger mt-2" role="alert">
                            {{ error }}
                            </div>
                        {% endfor %}
                        {% endif %}
                    </div>

                    <button type="submit" class="btn btn-primary w-100 mb-3">登录</button>
                    <button type="submit" class="btn btn-primary w-100 mb-3"><a href="/admin">进入后台</a></button>
                    <a class="btn btn-outline-primary w-100" href="{% url 'user:register' %}">没有账号？去注册</a>
                </form>
            </div>
        </div>
    </div>

    <!-- Bootstrap 5 JS（可选，若需要交互组件） -->
    <script src="/static/bootstrap/js/bootstrap.bundle.min.js"></script>
</body>
</html>